<div class="row">
    <div class="col-lg-12">
        <h3 class="page-header">Thêm Quản trị - Vùng</h3>
    </div>
    <!-- /.col-lg-12 -->
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-body">
                <div class="row">
                    <div class="col-lg-6">
                        <form role="form" method="POST" name="AddAdminArea" onsubmit="return checkinput();">
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-lg-3">
                                        <label>Tỉnh thành</label>
                                    </div>
                                    <div class="col-lg-6">
                                        <?php echo GlobalLib::getCombo("area_id", "province", "id", "name",$this->item->area_id) ?>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-lg-3">
                                        <label>Người Quản trị</label>
                                    </div>
                                    <div class="col-lg-6">
                                        <?php echo GlobalLib::getCombo("admin_id", "admin", "id", "user_name",$this->item->admin_id) ?>
                                    </div>
                                </div>
                            </div>                                             
                            <div class="form-group">
                                <div class="row">
                                <div class="col-lg-3">
                                    <label>Thứ tự</label>
                                </div>
                                <div class="col-lg-6">
                                    <input class="form-control" name="order" id="order" value="<?php echo $this->item->getOrder(); ?>">
                                </div>
                                </div>
                            </div>
                             <div class="form-group">
                                <div class="row">
                                <div class="col-lg-3">
                                    <label>Hiển thị</label>
                                </div>
                                <div class="col-lg-6">
                                    <input type="checkbox" name="status" id="status" value="1" 
                                        <?php echo ($this->item->getStatus() == 1 ? "checked=\"checked\"" : "") ?> >
                                </div>
                                </div>
                            </div>
                            <input id="selectionlog" style="display: none" name="selectionlog" />
                            <div class="form-group">
                                <button type="submit" class="btn btn-primary">Thêm mới</button>
                                <button type="reset" class="btn btn-default">Đặt lại</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>   
</div>
<script type="text/javascript">
    document.forms['AddAdminArea'].name.focus();
    function set_focus() {
        document.forms['AddAdminArea'].name.focus();
    }
    function checkinput() {
        var frm = window.document.AddAdminArea;
        if (frm.area_id.value == "0") {
            bootbox.alert("Vui lòng chọn tỉnh thành!");
            return false;
        }
        if (frm.admin_id.value == "0") {
            bootbox.alert("Vui lòng chọn người quản trị!");
            return false;
        }               
        return true;
    }
</script>
<script type="text/javascript">
     combo("area_id","selectionlog");
     combo("admin_id","selectionlog");
</script>